<extend name="Public:base" />
<block name="main">
     <h3>正在给"{$role_name}"分配权限</h3>
    <hr />
    <form name="theFrom" action="#" method="post">
        <div class="list-div">
            <div id="all">
            <table cellspacing="1" id="list-table">
                <tbody>
                    <tr>
                <php>
                    foreach($pauth_info as $key=>$val){
                </php>
                <td width="10%" valign="center" class="first-cell">
                    <label> 
                     <input type="checkbox" class="checkbox checkitems" value="<php> echo $val['auth_id'];</php>" name="authname[]" 
                     <php>if(in_array($val['auth_id'],$auth_ids_arr)){echo "checked='checked'";}</php> />
                     <php> echo $val['auth_name'];</php> 
                    </label>
                </td>

                <td width="90%" valign="top" class="first-cell">
                    <table>
                        <php>
                            foreach($sauth_info as $key2=>$val2){
                            if($val2['auth_pid'] == $val['auth_id']){
                        </php>
                        <tr>
                            <td width="10%" style="border-right:1px solid #ccc;border-bottom:1px solid #ccc;">
                                <label>
                                <input type="checkbox" class="checkbox checkitems onall<php>echo $val['auth_id'];</php>" value="<php> echo $val2['auth_id'];</php>" name="authname[]" 
                                <php>if(in_array($val2['auth_id'],$auth_ids_arr)){echo "checked='checked'";}</php> /> <php> echo $val2['auth_name'];</php>
                                </label>
                            </td>
                <td width="80%" style="border-bottom:1px solid #ccc;">
                <php>
                    foreach($tauth_info as $key3=>$val3){
                    if($val3['auth_pid']==$val2['auth_id']){
                </php>
                <div style="width:200px;float:left;">
                    <label>
                        <input type="checkbox" title="" class="checkbox onall<php>echo $val['auth_id']</php> onall<php>echo $val3['auth_pid']</php>" value="<php> echo $val3['auth_id'];</php>" name="authname[]" <php>if(in_array($val3['auth_id'],$auth_ids_arr)){echo "checked='checked'";}</php> />
                        <php> echo $val3['auth_name'];</php>
                    </label>
                </div>
                 <php>
                    }
                    }
                    </php>
                </td>
                </tr>
                <php>
                    }
                    }
                </php>
            </table>

            </td>
            </tr>
            <php>
                }
            </php>
            </div>
            <tr>
                <td align="center" colspan="3">
                    <div style="width:180px;margin-top:10px;">
                        <label style="width:100px;float:left;">
                            <input type="checkbox" class="checkbox" value="checkbox" id="checkall" />全选
                        </label>
                        <input type="submit" class="button" value=" 保存 " name="Submit" />
                    </div>
                </td>
            </tr>

            </tbody>
            </table>
        </div>
    </form>
    <script>
        $().ready(function(){
           $(".checkitems").click(function(){
              $id = $(this).attr("value");
              var checkedOfAll=$(this).prop("checked");   
               $(".onall"+$id).prop("checked", checkedOfAll);              
           });
        });
      //全部选择
      $('#checkall').click(function(){
          var checkedOfAll=$("#checkall").prop("checked");   
          $("input[name='authname[]']").prop("checked", checkedOfAll);
      });
    </script>
</block>